home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Totally AMOS
/
Totally AMOS - Issue 1 (1991-11)(Tucker, Len - Tucker, Anne).adf
/
source_progs
/
tutorial1.amos
/
tutorial1.amosSourceCode
Wrap
AMOS Source Code
|
1991-10-04
|
8KB
|
262 lines
'***scroll down this list and read all the "'" lines.
'***before you alter anything try running it first to see what it does
'
'***this turns the cursor off
'
Curs Off
'
'***this turns flash off, which is colour 3
'
Flash Off
'
'***this clears the screen, in this case to colour 0, but it could be
'***any number ranging from 0 to the total amount of colours used in
'***the screen you are working on, in this case 16. so the range would
'***be 0-15. Try out a few different numbers to see what it does.
'
Cls 0
'
'***this command lets you change the paper colour, in this case ranging
'***from 0-15. Try changing the number .
'
Paper 0
'
'***you can also change the pen/drawing colour with the command below.
'***again, change the number used to any number between 0-15.
'***but remember, if you use the same pen & paper colours you will not
'***see a lot!
'
Pen 1
'
'***now we ask the user (you!) for his/her name.
'
'***this command allows you to place the text cursor anywhere on the screen
'***that you want to, the first number is for the X axis, the X range is
'***between 0 and 39 for this size screen. the second number is for the
'***Y axis. The Y range for this size screen is 0 to 24. Now I will try
'***and explain X,Y ranges for you. In the box below if you count the
'***amount of "*"'s going across and down, you will see there are 40
'***for the X axis and 25 for the Y axis, this is because with a lot of
'***commands in basic you start counting from 0 not 1.
'
'****************************************
'* *
'*& *
'* *
'* *
'* This is how *
'* your screen looks *
'* to the 'Locate' command *
'* *
'* We used *
'* Locate 1,2 *
'* so the starting *
'* place for our printing *
'* Will be where you can see *
'* a '&' character *
'* If you count across starting *
'* from 0, then count down *
'* starting from 0, you should *
'* be able to see why the *
'* '&' is where it is. *
'* Try changing both numbers *
'* in the Locate command and see what *
'* happens. *
'* *
'****************************************
'
Locate 1,2
'
'***the input command makes the computer wait for a 'return' or
'***'enter' key to be pressed, until then you can press any other key
'***on the keyboard and the computer (from here on will call the computer
'*** Amy) will put all the characters you press into a string variable,
'***these are like little boxes in Amy's memory where she remembers things
'***in this case the box is called NAME$, so if you want the information
'***that Amy put into that box at any time in your program, just work with
'***the variable(box) called NAME$.
'
Input "What is your name?";NAME$
'
'***here we are changing the print position to goto 2 lines down from the
'***first print.
'
Locate 1,4
'
'***now change the pen colour to help pretty things up a bit.
'
Pen 4
'
'***this input is slightly different from the one above, this one uses
'***a different type of variable (box), it is a neumeric variable,
'***do not worry about its name, the only difference between the 2 types
'***is the type we used for the name (NAME$, remember?) will remember
'***letters AND numbers, the other one (AGE) will only remember numbers
'***the main reason for the 2 types is with the NAME$ type variable(box)
'***you cannot perform any mathematical work with it and the AGE
'***variable (box) you can.
'
Input "How old are you?";AGE
'
'***right, now we can play with the informaion inside the 2 boxes
'***as much as we like!! But first lets tidy up the screen, which
'***by the way is called Screen 0. We do this with a command we have
'***already used.before I show you the command can you guess which one it is?
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'***the command is cls. Did you guess right?
'***I think we shall us a different screen colour for this bit
'***but don't forget if you change the background colour, change the
'***paper colour
'
Cls 6
'
'***change the paer colour to match the background.
'
Paper 6
'
'***now change the pen colour to white
'
Pen 2
'
'***now to use the information inside the boxes NAME$ & AGE
'
'***first use locate to position the printing
'
Locate 5,2
'
'***Now print something
'
Print "Hello ";NAME$
'
'***move the print position
'
Locate 5,4
'
'***now print about the age
'
Print "Do you like being";AGE
'
'*** move print position again
'
Locate 5,6
'
'***now print some more
'
Print "I bet you are looking"
'
Locate 5,8
'
'***the line below this does some maths to the box 'AGE' , can you see it?
'***we are printing what ever is in the box called AGE+1 so if there is
'***a number 5 in the box it will print 6 (5+1=6)
'
Print "forward to being";AGE+1
'
'***tell the user what he/she has to do!
'
Print "Press any key to continue."
'
'***wait key, this command tells Amy to wait until a key has
'***been pressed before going on.
'
Wait Key
'
'***clear the screen again
Cls 6
'
'***or you could do some thing like this.
'***there are 2 new commands in this bit 'For' and 'Next' these to commands
'***are ALWAYS used together, they are to create a Loop, which means that
'***whatever is inside them must be done Z (or any other variable(box) name)
'***start the loop by telling Amy to do something 10 times (1-10)
'
For Z=1 To 10
'***now we use the numbers in locate with a variable so the print position
'***is different every time the loop passes the locate
Locate Z,Z
'***the ';' in the print line just tells Amy that you have not
'***finnished printing on that line yet.
Print NAME$;" is ";AGE
'
Next Z
'
Print "Press any key to continue."
'
Wait Key
'***right, thats it for this issue, see how you can change things in this
'***little proggy, the commands we have used so far are:- cls, flash off
'***curs off, input, locate, paper, pen, For, Next and print.
'***using just these commands will allow you to create quite a few
'***interesting programs.
'***when you have finnished playing with the numbers in this listing
'***either get your mother, father or yourself to delete the 'end' command
'***below to see what I have done with just the above commands.
'***do not worry about the procedure command yet, we will cover that
'***in a future issue
End
EXAMPLE
'***To open this procedure move the cursor to the 'procedure' line
'***then either press F9 or move the mouse to 'fold/unfold' box at the
'***top of the screen.
'***do not worry if you don't understand the example yet, it's just to
'***show what can be done with the commands covered.
Procedure EXAMPLE
Shared NAME$,AGE
OLDAGE=AGE
Cls 0
For Z=1 To 11
Locate Z,Z
Pen Z
Paper Z-1
Print NAME$;" is ";AGE
Next Z
For Z=1 To 11
Locate 11-Z,11+Z
Pen Z
Paper Z-1
Print NAME$;" is ";AGE
Next Z
Print "Press a key to continue"
Wait Key
Paper 0
Pen 2
For TURNS=1 To 3
Pen TURNS
For Y=0 To 23
For X=0 To 20
Wait 1
Locate X,Y
Curs Off
Print " ";NAME$;" is ";AGE
Next X
Next Y
Add AGE,1
Next TURNS
Print "Press a key to continue"
Wait Key
For Y=1 To 22
For Z=1 To 22-Y
Locate 2,23-Z
Print " "
Locate 2,22-Z
Print " ";NAME$;" is ";OLDAGE
Next Z
Next Y
Pen 2
Locate 5,12
Print "Bye bye for this issue"
End Proc